import os

# 修复SSL权限错误 - 禁用SSL密钥日志
os.environ['SSLKEYLOGFILE'] = ''
from langchain_openai import ChatOpenAI
from langchain_core.prompts import PromptTemplate
from pydantic import SecretStr

llm=ChatOpenAI(
    model="qwen3-max",
    base_url="https://dashscope.aliyuncs.com/compatible-mode/v1",
    api_key=SecretStr("sk-f648b6ff7a0b40999edc8c15ec81c459"),
    streaming=True,
)

prompt_template = PromptTemplate.from_template("今天{something}真不错")
print(prompt_template)
prompt = prompt_template.format(something="天气")
print(prompt)
# resp = llm.stream(
#     "你是谁？"
# )
# for chunk in resp:
#     print(chunk.content, end="", flush=True)
#     print("\n")